package com.jcsz.gulimall.member.web;

import com.alibaba.fastjson.JSON;
import com.jcsz.common.utils.PageUtils;
import com.jcsz.common.utils.R;
import com.jcsz.gulimall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @className: MemberWebController
 * @author: 一把Po吉他
 * @date: 2022/11/16 23:11
 * @version: 1.0
 **/
@Controller
public class MemberWebController {

    @Autowired
    OrderFeignService orderFeignService;

    @GetMapping("memberOrder.html")
    public String orderList(@RequestParam(value = "page", defaultValue = "1") Integer pageNum, Model model) {
        Map<String, Object> params = new HashMap<>();
        params.put("page", pageNum);
        R orderInfos = orderFeignService.listWithItem(params);
        System.out.println(JSON.toJSONString(orderInfos));
        model.addAttribute("orders",orderInfos);
        return "orderList";
    }

}
